import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    meta:{title:'首页'}
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register.vue'),
    meta:{title:'注册页'}
  },
  {
    path:'/login',
    name:'Login',
    component:()=> import('../views/Login.vue'),
    meta:{title:'登录页'}
  }
]
const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})
router.beforeEach((to,form,next)=>{
  document.title=to.meta.title;
  next()
})
export default router
